package com.chms.daoImpl; 

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.chms.dao.IRegistrationDao;
import com.chms.utility.DBConstant;
import com.chms.utility.QueryConstant;

public class RegistrationDao extends BaseDao implements IRegistrationDao {

	public boolean saveUser(String userName, String password) {
		// Prepare the parameters
		int pk = 0;
		int resultCount = 0;
		List lParamList = new ArrayList();
		try {
			pk = getPrimaryKey("USER_LOGIN_ID", "JBSULT");
			lParamList.add(0, pk);
			lParamList.add(1, userName);
			lParamList.add(2, null);
			lParamList.add(3, password);
			lParamList.add(4, DBConstant.IS_ACTIVE_YES);
			lParamList.add(5, new Timestamp(new Date().getTime()));
			lParamList.add(6, new Timestamp(new Date().getTime()));
			lParamList.add(7, null);
			lParamList.add(8, null);
			lParamList.add(9, null);
			lParamList.add(10, "piyush");
			lParamList.add(11, "piyush");

			// Get the query by passing parameters
			String query = getQuery(QueryConstant.SAVE_USER, lParamList);
			resultCount = insert(query);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		if (resultCount != 0) {
			return true;
		} else
			return false;

	}

}
